package com.snlab.backend.deltanet;

import com.snlab.netGraph.Device;
import com.snlab.netGraph.Rule;

import java.util.HashMap;
import java.util.HashSet;

public class Verifier {
    private HashMap<Integer, Atom> atomMap;
    private AVLTree<Atom> atoms;

    public Verifier() {
        this.atomMap = new HashMap<>();
        this.atoms = new AVLTree<>();
    }

//    private Atom findLower(int id) {
//
//    }

    private void createAtoms(Rule rule) {
        int remain = 32 - rule.getPrefix();
        int lower = rule.getDstIp() >> remain << remain;
        int upper = lower + (2 << remain - 1);
        HashSet<HashMap<Atom, Atom>> delta = new HashSet<>();
        Atom lowerAtom = new Atom(lower);
        Atom upperAtom = new Atom(upper);
        if (!this.atoms.contains(lowerAtom)) {
            this.atoms.insert(lowerAtom);
        }
        if (!this.atoms.contains(upperAtom)) {
            this.atoms.insert(upperAtom);
        }
    }

    public void insertRule(Device device, Rule rule) {

    }

    public static void main(String[] args) {
        long x = 7;
        System.out.println((x >> 2) << 2);
    }
}
